Skip to content

Develop - #686

Merged
ShaneIsrael merged 4 commits into
mainfrom
develop
Aug 6, 2026
Merged

Develop#686
ShaneIsrael merged 4 commits into
mainfrom
develop

Conversation

@ShaneIsrael

Copy link
Copy Markdown
Owner

This pull request introduces several improvements to file and resource cleanup, security, and code maintainability across the backend and frontend. The main changes include refactoring and centralizing the logic for deleting video files and canceling pending transcode jobs, improving upload folder sanitization, and enhancing media resource management in the frontend to prevent resource leaks.

Backend: Video Deletion and Cleanup Improvements

  • Centralized and refactored all video file deletion logic into a new delete_video_files helper, which robustly removes all on-disk artifacts and logs errors per file, replacing duplicated code in multiple endpoints (video.py, game.py, tag.py, admin.py). [1] [2] [3] [4] [5]
  • Added cancel_pending_transcode_jobs helper to ensure any queued transcode jobs for deleted videos are removed, preventing orphaned jobs from recreating deleted files. This is now called in all relevant delete endpoints. [1] [2] [3] [4] [5]
  • Improved derived directory removal with a retry-and-stage approach in remove_derived_dir, handling race conditions with background jobs.

Backend: Upload Folder Security and Consistency

  • Replaced ad-hoc folder name validation with a new sanitize_upload_folder helper, ensuring user-supplied upload folder names are safe and consistent across all upload endpoints (upload.py, image.py). [1] [2] [3] [4] [5] [6] [7]

Frontend: Media Resource Management

  • In VideoModal.js, explicitly nullifies the player reference on modal close to allow garbage collection of the <video> element and its decoder resources.
  • In VideoJSPlayer.js, ensures the <video> element is fully detached from its media source on unmount, preventing Chrome from leaking decoder resources and avoiding GPU process crashes.

Other Improvements

  • When scanning for media folders, reactivates previously unavailable folders if new media is added, ensuring folders are not hidden unnecessarily.
  • Removed redundant imports and cleaned up code for maintainability.

These changes make file operations more reliable, improve upload security, and address potential frontend resource leaks.

@ShaneIsrael
ShaneIsrael merged commit ef1bcc5 into main Aug 6, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants